home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / windows / winthrea / thrdapi.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1994-03-22  |  3.9 KB  |  136 lines

  1. Unit ThrdAPI;
  2.  
  3. {
  4. ********************************************************************
  5. *                    EDI Threads Pascal Interface                  *
  6. *                                                                  *
  7. ********************************************************************
  8. *       Copyright 1992 Robert Salesas, All Rights Reserved         *
  9. ********************************************************************
  10. *      Version: 1.00             Author:  Robert Salesas           *
  11. *      Date:    22-May-1992      Changes: Original                 *
  12. *                                                                  *
  13. ********************************************************************
  14. }
  15.  
  16.  
  17. Interface
  18.  
  19.  
  20. Uses WinTypes;
  21.  
  22.  
  23.  
  24. Type
  25.   PThreadRec = Pointer;
  26.  
  27.   PThreadFunc = ^TThreadFunc;
  28.   TThreadFunc = Procedure(Thread : PThreadRec;  Wnd : HWnd;  wParam : Word;  lParam : LongInt);
  29.  
  30.  
  31. Const
  32.   tm_User     = $0100;                { Starting user message to pass to a thread }
  33.   tm_Quit     = $0001;                { Thread has ended or must end }
  34.   tm_Continue = $0002;                { Thread can continue or is continuing }
  35.   tm_Paused   = $0003;                                { Thread is currently paused }
  36.   tm_Error    = $0004;                { Error: Not a thread? }
  37.  
  38.   ts_DefTimeSlice = 50;               { Default time slice }
  39.   ts_DefPriority  = 100;              { Default thread priority }
  40.  
  41.  
  42.   Function GetThrdUtlsVersion : Word;
  43.   { Returns major revision in high byte, minor revision in low byte. }
  44.  
  45.   Function GetNumThreads : Word;
  46.  
  47.   Procedure SetThrdUtlsTimeSlice(ATimeSlice : Word);
  48.  
  49.   Function GetCurrentThread : PThreadRec;
  50.  
  51.  
  52.   Function CreateThread(ThreadFunc : PThreadFunc;  StackSize : Word;
  53.                         Wnd : HWnd;  wParam : Word;  lParam : LongInt) : PThreadRec;
  54.  
  55.   Procedure DisposeThread(Var Thread : PThreadRec);
  56.  
  57.   Function ExecThread(Thread : PThreadRec) : Word;
  58.  
  59.   Function YieldThread : Word;
  60.  
  61.   Procedure ExitThread;
  62.  
  63.   Procedure TerminateThread(Thread : PThreadRec);
  64.  
  65.   Procedure SetThreadPriority(Thread : PThreadRec;  Priority : Word);
  66.  
  67.   Procedure SetThreadPause(Thread : PThreadRec;  Paused : Bool);
  68.  
  69.   Function IsThreadPaused(Thread : PThreadRec) : Bool;
  70.  
  71.   Function IsThreadFinished(Thread : PThreadRec) : Bool;
  72.  
  73.   
  74.   Function AddThread(Thread : PThreadRec) : Bool;
  75.  
  76.   Procedure RemoveThread(Thread : PThreadRec);
  77.  
  78.   Function StartThread(ThreadFunc : PThreadFunc;  StackSize : Word;
  79.                        Wnd : HWnd;  wParam : Word;  lParam : LongInt) : PThreadRec;
  80.  
  81.   Procedure EndThread(Var Thread : PThreadRec);
  82.  
  83.   Procedure ExecTaskThreads(Task : THandle);
  84.  
  85.   Procedure EndTaskThreads(Task : THandle);
  86.  
  87.  
  88.  
  89.  
  90. Implementation
  91.  
  92.  
  93.   Function GetThrdUtlsVersion;  External 'THRDUTLS' Index 100;
  94.  
  95.   Function GetNumThreads;  External 'THRDUTLS' Index 110;
  96.  
  97.   Procedure SetThrdUtlsTimeSlice;  External 'THRDUTLS' Index 120;
  98.  
  99.   Function GetCurrentThread;  External 'THRDUTLS' Index 130;
  100.  
  101.  
  102.   Function CreateThread;  External 'THRDUTLS' Index 200;
  103.  
  104.   Procedure DisposeThread;  External 'THRDUTLS' Index 210;
  105.  
  106.   Function ExecThread;  External 'THRDUTLS' Index 220;
  107.  
  108.   Function YieldThread;  External 'THRDUTLS' Index 230;
  109.  
  110.   Procedure ExitThread;  External 'THRDUTLS' Index 240;
  111.  
  112.   Procedure TerminateThread;  External 'THRDUTLS' Index 250;
  113.  
  114.   Procedure SetThreadPriority;  External 'THRDUTLS' Index 260;
  115.  
  116.   Procedure SetThreadPause;  External 'THRDUTLS' Index 270;
  117.  
  118.   Function IsThreadPaused;  External 'THRDUTLS' Index 280;
  119.  
  120.   Function IsThreadFinished;  External 'THRDUTLS' Index 290;
  121.  
  122.  
  123.   Function AddThread;  External 'THRDUTLS' Index 300;
  124.  
  125.   Procedure RemoveThread;  External 'THRDUTLS' Index 310;
  126.  
  127.   Function StartThread;  External 'THRDUTLS' Index 320;
  128.  
  129.   Procedure EndThread;  External 'THRDUTLS' Index 330;
  130.  
  131.   Procedure ExecTaskThreads;  External 'THRDUTLS' Index 340;
  132.  
  133.   Procedure EndTaskThreads;  External 'THRDUTLS' Index 350;
  134.  
  135.  
  136. End. {ThrdAPI}